Online documentation - WebsydianExpress v3.5 |
This describes a simple example of how you can use functions that inherit from ExtWebDropDown in your applications.
An implementation of the sample can be found in the EXPRESSTEST model.
A running version of the sample can be found in the delivered sample site.
The sample shows an implementation of:
The implementation is found scoped by the function TestDropDown - which is also the ProcessEntryPoint.
The ProcessEntryPoint is just used to make the sample available from the menu.
The ProcessEntryPoint is created using the following triples:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown | is a FNC | WSYAPI/ProcessEntryPoint |
TestDropDown | implement SYS | Yes |
TestDropDown | impl name NME | WATSTDD |
TestDropDown | file name NME | WATSTDD |
The sample shows how you can create your own drop down function for the Country entity you can find in the EXPRESSTEST model.
To have the objects for this example in one place, the function will be scoped by the TestDropDown function - in most normal situations you would probably scope the function by the Country entity.
You create the drop down by creating the following triples:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown | includes FNC | CountryDD |
TestDropDown.CountryDD | is a FNC | WSYEXTJS/ExtWebDropDown |
TestDropDown.CountryDD | implement SYS | Yes |
TestDropDown.CountryDD | impl name NME | WATSTDDD |
TestDropDown.CountryDD | file name NME | WATSTDDD |
TestDropDown.CountryDD._CreateTemplates | implement SYS | Yes |
TestDropDown.CountryDD.LoadData | implement SYS | Yes |
You must define a view and a BlockFetch function that will be used to populate the list of records in the drop down.
The view will sort the records by the name of the country followed by the unique identification of the country. Note that the BlockFetch functions used to populate the grids in the Ext JS framework for WebsydianExpress inherits from StatelessBlockFetch - so the views must have a unique key.
By inheriting from RRNEntityRelationalTable.Fetch, the view will scope a suitable BlockFetch for populating the grid.
Source Object | Verb | Target Object |
---|---|---|
Country | view VW | FetchByCountryName |
Country.FetchByCountryName | is a VW | WSYBASE/RRNEntityRelationalTable.Fetch |
Country.FetchByCountryName | ordered on SYS | Selected |
Country.FetchByCountryName | key FLD
...precedence |
Country.Fields.Country
10 |
Country.FetchByCountryName | key FLD
...precedence |
Country.Fields.CountryID
20 |
Country.FetchByCountryName.WsyStatelessBlockFetchRRN | is a FNC | STORAGE/ServerExternal |
Replace the view and BlockFetch to make it use the new ones:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown.CountryDD | replaces VW
...by VW |
UIBASIC/UIBasic.Grid
Country.FetchByCountryName |
TestDropDown.CountryDD | replaces FNC
...by FNC |
UIBASIC/UIBasic.Grid.BlockFetch
Country.FetchByCountryName.WsyStatelessBlockFetchRRN |
The CountryID is a UUID - which should not be shown in the drop down - remove this from the content by the following triple:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown.CountryDD | local FLD
...for VAR |
Country.Fields.CountryID
OmitGridFields |
At this point, the sort order, the content, and the function that will retrieve the data is defined - so the function is able to populate the grid.
The last thing you must define is what field the function will return when a record is selected. This is done by the following triple:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown.CountryDD | local FLD
...for VAR |
Country.Fields.CountryID
WsyReturnsValueOf |
The sample will show how you can use the drop down function for the Country entity, even though you have another field that you want to populated with the selected value.
Create this field by creating the following triples:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown | field FLD | CountryID |
TestDropDown.CountryID | is a FLD | Country.Fields.CountryID |
To force this field to use the drop down to shown and obtain values enter the following triple:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown | special type NME
...output FNC |
wsyremotedatastore
TestDropDown.CountryDD |
This is the PageGenerator that will contain TestDropDown.CountryID as an output field - and have an EventHandler that has the field as an input field.
Create the PageGenerator:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown | includes FNC | Page |
TestDropDown.Page | is a FNC | WSYEXTJS/ExtPageGenerator |
TestDropDown.Page | input field | TestDropDown.CountryID |
TestDropDown.Page | local FLD
...for VAR |
TestDropDown.CountryID
WsyDetails |
TestDropDown.Page | implement SYS | Yes |
TestDropDown.Page | impl name NME | WATSTDDP |
TestDropDown.Page | file name NME | WATSTDDP |
TestDropDown.Page._CreateTemplates | implement SYS | Yes |
Add the EventHandler:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown.Page | includes FNC | Test |
TestDropDown.Page.Test | is a FNC | WSYEXTJS/ExtEventHandler |
TestDropDown.Page.Test | local FLD
...for VAR |
TestDropDown.CountryID
WebInput |
TestDropDown.Page.Test | implement SYS | Yes |
To make the Page function able to call the drop down, the Page has to comprise (or include) the drop down function. When one of these triples are available, meta code in the Page function is able to identify and call the correct drop down function.
Source Object | Verb | Target Object |
---|---|---|
TestDropDown.Page | comprises FNC | TestDropDown.CountryDD |
The Page function will perform a call to the CountryDD function. Fields found in the local variables InputForChild and WsyDetails will be used for parameter mapping.
The CountryDD function has two input fields, however the function does not use the values for anything so you do not have to ensure that the data mapped to these parameters are meaningful. However, dependent on your mappings restrictions for the parameter fields, you might get some warnings about missing parameter mappings when generating the Page function. To avoid these, you can add the input parameters for the CountryDD funtion to the local variable InputForChild of the Page function:
Source Object | Verb | Target Object |
---|---|---|
TestDropDown.Page | local FLD
...for VAR |
Country.Fields.CountryID
InputForChild |
TestDropDown.Page
|
local FLD
...for VAR |
Country.Fields.Country
InputForChild |
Add the following code to the edit point "Call to first PageGenerator" in the TestDropDown function:
Call TestDropDown.Page
Map with:
<TestDropDown.CountryID.*Blank>
Add the following code to the edit point "0 call to build of document" in the function TestDropDown.Page.Test:
Call TestDropDown.Page
Map with:
WebInput<TestDropDown.CountryID>
Add the following code to the edit point "0 Process input" in the function TestDropDown.Page:
Set WsyDetails = Input
Generate and build TestDropDown and all scoped functions.
Run TestDropDown.Page._CreateTemplates and TestDropDown.CountryDD._CreateTemplates.
Deploy the generated files (8 in all) to the template folder of the site you want to test in.
Deploy the generated program objects to your WebsydianExpress installation.
Define a business process content loader with the implementation name WATSTDD.
Add this content loader to the site structure.
1. Press the menu item - this should show the following page:
This shows the output field and the drop down box that has replaced the input field.
2. Open the drop down box:
This shows the available countries.
3. Select a country and press the Test button:
The EventHandler receives the selected value, transfers it as a parameter to the Page, which writes the value to WsyDetails - this value is shown for the output field and the drop down shows the value as the currently selected value.
Note that the output field has got the same format as the drop down - this is because it is handled just like the drop down box, just with another style, which means that you can't select a value in the output field.